<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <link type="text/css" rel="stylesheet" href="../style.css" />
    <link type="text/css" rel="stylesheet" href="style.css" />
    <h:head>
        <title>Claim Insurance Home Page</title>
    </h:head>
    <h:body styleClass="form">
        <h:form>
            <h:commandLink value="Logout" action="#{login.logout()}" />
            <h1>Index</h1>
            <p><br/><br/></p>
            <c:choose>
                <c:when test="#{login.isLoggedIn}">
                    <c:choose>
                        <c:when test="#{login.renderPage('customerMain')}">
                            <p>
                                <h:link value="Create Claim Damage Application" outcome="customerNewClaims" />
                                <br/>
                            </p>
                            <p>
                                <h:commandLink value="View Claims" action="viewClaims">
                                    <f:setPropertyActionListener target="#{claimManager.userName}" value="#{login.userName}"/>
                                    <f:setPropertyActionListener target="#{claimManager.userGroup}" value="#{login.userRole}"/>
                                </h:commandLink>
                                <br/>
                            </p>
                            <p>
                                <h:commandLink value="Update Incomplete Claim" action="incompleteClaims">
                                    <f:setPropertyActionListener target="#{updateIncompleteClaim.userName}" value="#{login.userName}"/>
                                    <f:setPropertyActionListener target="#{updateIncompleteClaim.userGroup}" value="#{login.userRole}"/>
                                </h:commandLink>
                            </p>
                        </c:when>
                        <c:when test="#{login.renderPage('officerMain')}">
                            <p>
                                <h:commandLink value="View Claims" action="viewClaims">
                                    <f:setPropertyActionListener target="#{claimManager.userName}" value="#{login.userName}"/>
                                    <f:setPropertyActionListener target="#{claimManager.userGroup}" value="#{login.userRole}"/>
                                </h:commandLink>
                                <br/>
                            </p>
                            <p>
                                <h:commandLink value="Evaluate Claims" action="evaluateClaims">
                                    <f:setPropertyActionListener target="#{evaluationClaim.userName}" value="#{login.userName}"/>
                                    <f:setPropertyActionListener target="#{evaluationClaim.userGroup}" value="#{login.userRole}"/>
                                </h:commandLink>
                                <br/>
                            </p>

                        </c:when>
                        <c:when test="#{login.renderPage('adminMain')}">
                            <p>
                                <h:commandLink value="View Claims" action="viewClaims">
                                    <f:setPropertyActionListener target="#{claimManager.userName}" value="#{login.userName}"/>
                                    <f:setPropertyActionListener target="#{claimManager.userGroup}" value="#{login.userRole}"/>
                                </h:commandLink>
                                <br/>
                            </p>
                            <p>
                                <h:commandLink value="Update Claims" action="evaluateClaims">
                                    <f:setPropertyActionListener target="#{evaluationClaim.userName}" value="#{login.userName}"/>
                                    <f:setPropertyActionListener target="#{evaluationClaim.userGroup}" value="#{login.userRole}"/>
                                </h:commandLink>
                                <br/>
                            </p>

                        </c:when>
                         <c:when test="#{login.renderPage('garageMain')}">
                            <p>
                                <h:commandLink value="View Claims" action="viewClaims">
                                    <f:setPropertyActionListener target="#{claimManager.userName}" value="#{login.userName}"/>
                                    <f:setPropertyActionListener target="#{claimManager.userGroup}" value="#{login.userRole}"/>
                                </h:commandLink>
                                <br/>
                            </p>
                            <p>
                                <h:commandLink value="Update Repaired Cars" action="repairCar">
                                    <f:setPropertyActionListener target="#{garageManager.userName}" value="#{login.userName}"/>
                                    <f:setPropertyActionListener target="#{garageManager.userGroup}" value="#{login.userRole}"/>
                                </h:commandLink>
                                <br/>
                            </p>
                        </c:when>
                    </c:choose>
                </c:when>
                <c:otherwise>
                    <p>
                        <h:link value="register" outcome="register" />
                        <br/>
                    </p>
                </c:otherwise>
            </c:choose>
        </h:form>
    </h:body>
</html>
